/*
using MyGeneration/Template/NHibernate (c) by Sharp 1.4
based on OHM (alvy77@hotmail.com)
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace DomainModel
{

	/// <summary>
	/// IUserClass interface for NHibernate mapped table 'UserClass'.
	/// </summary>
	public interface IUserClass
	{
		#region Public Properties
		
		int uic_id
		{
			get ;
			set ;
			  
		}
		
		string uic_class
		{
			get ;
			set ;
			  
		}
		
		string uic_teacher
		{
			get ;
			set ;
			  
		}
		
		int uic_state
		{
			get ;
			set ;
			  
		}
		
		DateTime uic_date
		{
			get ;
			set ;
			  
		}
		
		int uic_user
		{
			get ;
			set ;
			  
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
	}

	/// <summary>
	/// UserClass object for NHibernate mapped table 'UserClass'.
	/// </summary>
	[Serializable]
	public class UserClass : ICloneable,IUserClass
	{
		#region Member Variables

		protected int _uic_id;
		protected string _uic_class;
		protected string _uic_teacher;
		protected int _uic_state;
		protected DateTime _uic_date;
		protected int _uic_user;
		protected bool _bIsDeleted;
		protected bool _bIsChanged;
		#endregion
		
		#region Constructors
		public UserClass() {}
		
		public UserClass(string puicclass, string puicteacher, int puicstate, DateTime puicdate, int puicuser)
		{
			this._uic_class = puicclass; 
			this._uic_teacher = puicteacher; 
			this._uic_state = puicstate; 
			this._uic_date = puicdate; 
			this._uic_user = puicuser; 
		}
		
		public UserClass(string puicclass, int puicstate, DateTime puicdate, int puicuser)
		{
			this._uic_class = puicclass; 
			this._uic_state = puicstate; 
			this._uic_date = puicdate; 
			this._uic_user = puicuser; 
		}
		
		public UserClass(int puicid)
		{
			this._uic_id = puicid; 
		}
		
		#endregion
		
		#region Public Properties
		
		public virtual int uic_id
		{
			get { return _uic_id; }
			set { _bIsChanged |= (_uic_id != value); _uic_id = value; }
			
		}
		
		public virtual string uic_class
		{
			get { return _uic_class; }
			set 
			{
			  if (value != null && value.Length > 50)
			    throw new ArgumentOutOfRangeException("uic_class", "uic_class value, cannot contain more than 50 characters");
			  _bIsChanged |= (_uic_class != value); 
			  _uic_class = value; 
			}
			
		}
		
		public virtual string uic_teacher
		{
			get { return _uic_teacher; }
			set 
			{
			  if (value != null && value.Length > 20)
			    throw new ArgumentOutOfRangeException("uic_teacher", "uic_teacher value, cannot contain more than 20 characters");
			  _bIsChanged |= (_uic_teacher != value); 
			  _uic_teacher = value; 
			}
			
		}
		
		public virtual int uic_state
		{
			get { return _uic_state; }
			set { _bIsChanged |= (_uic_state != value); _uic_state = value; }
			
		}
		
		public virtual DateTime uic_date
		{
			get { return _uic_date; }
			set { _bIsChanged |= (_uic_date != value); _uic_date = value; }
			
		}
		
		public virtual int uic_user
		{
			get { return _uic_user; }
			set { _bIsChanged |= (_uic_user != value); _uic_user = value; }
			
		}
		

		public virtual bool IsDeleted
		{
			get
			{
				return _bIsDeleted;
			}
			set
			{
				_bIsDeleted = value;
			}
		}
		
		public virtual bool IsChanged
		{
			get
			{
				return _bIsChanged;
			}
			set
			{
				_bIsChanged = value;
			}
		}
		
		#endregion 
		
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			UserClass castObj = null;
			try
			{
				castObj = (UserClass)obj;
			} catch(Exception) { return false; } 
			return ( castObj != null ) &&
				( this._uic_id == castObj.uic_id );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _uic_id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region ICloneable methods
		
		public virtual object Clone()
		{
			return this.MemberwiseClone();
		}
		
		#endregion
	}
	
	#region Custom ICollection interface for UserClass 

	
	public interface IUserClassCollection : ICollection
	{
		UserClass this[int index]{	get; set; }
		void Add(UserClass pUserClass);
		void Clear();
	}
	
	[Serializable]
	public class UserClassCollection : IUserClassCollection
	{
		private IList<UserClass> _arrayInternal;

		public UserClassCollection()
		{
			_arrayInternal = new List<UserClass>();
		}
		
		public UserClassCollection( IList<UserClass> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<UserClass>();
			}
		}

		public UserClass this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((UserClass[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(UserClass pUserClass) { _arrayInternal.Add(pUserClass); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<UserClass> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
